﻿<Window x:Class="ThumbGen.Subtitles.ChooseSubtitles"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    SizeToContent="WidthAndHeight" WindowStyle="None" ResizeMode="NoResize" MinWidth="600"
    AllowsTransparency="False" Background="Transparent" ShowInTaskbar="False">
    <Window.Resources>
                                    
    </Window.Resources>
    <Border Padding="1" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1" Background="White">
        <Border Padding="5" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1" Background="White"
                HorizontalAlignment="Stretch">
            <Grid MinWidth="100" MinHeight="30" HorizontalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" x:Name="DescriptionBlock" Margin="5" HorizontalAlignment="Center" Text="Choose the correct subtitle for the current movie"/>
                <ListBox Grid.Row="1" x:Name="SubtitlesBox" Margin="10" HorizontalAlignment="Stretch" MaxHeight="500"
                         IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Grid.IsSharedSizeScope="True"
                         VirtualizingStackPanel.IsVirtualizing="False">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="5">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" MinWidth="150" SharedSizeGroup="One" MaxWidth="500"/>
                                    <ColumnDefinition MinWidth="50" SharedSizeGroup="Two"/>
                                    <ColumnDefinition MinWidth="80" SharedSizeGroup="Three"/>
                                    <ColumnDefinition MinWidth="80" SharedSizeGroup="Four"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <!--<TextBlock Grid.Row="0" Grid.Column="0" Text="Movie Name" HorizontalAlignment="Center" />
                                <TextBlock Grid.Row="0" Grid.Column="1" Text="CD#" HorizontalAlignment="Center" />
                                <TextBlock Grid.Row="0" Grid.Column="2" Text="Uploaded/Format" HorizontalAlignment="Center" />
                                <TextBlock Grid.Row="0" Grid.Column="3" Text="Downloads" HorizontalAlignment="Center" />-->
                                
                                <StackPanel Grid.Row="1" Grid.Column="0" TextBlock.FontWeight="Bold" 
                                            Orientation="Horizontal" HorizontalAlignment="Left" ToolTip="Movie Name/Release Year"
                                            MaxWidth="500">
                                    <TextBlock Text="{Binding MovieName}" TextTrimming="CharacterEllipsis" />
                                    <TextBlock Text=" ( " />
                                    <TextBlock Text="{Binding MovieYear}" />
                                    <TextBlock Text=" )" />
                                </StackPanel>
                                <TextBlock Grid.Row="2" Grid.Column="0" FontSize="10" Text="{Binding MovieReleaseName}" ToolTip="Release Name" />
                                <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" ToolTip="CD Number / Total CDs">
                                    <TextBlock Text="{Binding SubActualCD}" />
                                    <TextBlock Text=" / " />
                                    <TextBlock Text="{Binding SubSumCD}" />
                                </StackPanel>
                                <TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding SubAddDate}" ToolTip="Uploaded Date"/>
                                <TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding SubFormat}" ToolTip="Subtitle file format"/>
                                <TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding SubDownloadsCnt,StringFormat=\{0\}x}" HorizontalAlignment="Right" 
                                           ToolTip="Downloads" />
                                <TextBlock Grid.Row="2" Grid.Column="3" Text="{Binding LanguageName}" ToolTip="Subtitle Language" HorizontalAlignment="Right"/>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
                    <Button x:Name="OkButton" ToolTip="Use the selected subtitle"
                            Content="Choose it!" MinWidth="75" Margin="3" IsDefault="True" Click="OkButton_Click"/>
                    <Button x:Name="Cancel" ToolTip="Skip selecting a subtitle"
                            Content="Cancel" MinWidth="75" Margin="3" IsCancel="True"/>
                </StackPanel>
            </Grid>
        </Border>
    </Border>

</Window>